<?php
class system_db_table_definition {
	
	/**
	 * @var array
	 */
	protected $_tableConfigs = array();
	
	/**
	 * __construct()
	 *
	 * @param array|Zend_Config $options
	 */
	public function __construct(array $options = array()) {
		$this->setOptions($options);
	}
	
	/**
	 * setOptions()
	 *
	 * @param array $options
	 * @return Zend_Db_Table_Definition
	 */
	public function setOptions(Array $options) {
		foreach($options as $optionName => $optionValue) {
			$this->setTableConfig($optionName, $optionValue);
		}
		return $this;
	}
	
	/**
	 * @param string $tableName
	 * @param array  $tableConfig
	 * @return Zend_Db_Table_Definition
	 */
	public function setTableConfig($tableName, array $tableConfig) {
		// @todo logic here
		$tableConfig[system_db_table::DEFINITION_CONFIG_NAME] = $tableName;
		$tableConfig[system_db_table::DEFINITION] = $this;
		
		if(!isset($tableConfig[system_db_table::NAME])) {
			$tableConfig[system_db_table::NAME] = $tableName;
		}
		
		$this->_tableConfigs[$tableName] = $tableConfig;
		return $this;
	}
	
	/**
	 * getTableConfig()
	 *
	 * @param string $tableName
	 * @return array
	 */
	public function getTableConfig($tableName) {
		return $this->_tableConfigs[$tableName];
	}
	
	/**
	 * removeTableConfig()
	 *
	 * @param string $tableName
	 */
	public function removeTableConfig($tableName) {
		unset($this->_tableConfigs[$tableName]);
	}
	
	/**
	 * hasTableConfig()
	 *
	 * @param string $tableName
	 * @return bool
	 */
	public function hasTableConfig($tableName) {
		return (isset($this->_tableConfigs[$tableName]));
	}

}